Raspberry Piにgoogle-home-notifierをインストールする方法
google-home-notifierの公式ページ の通りに実行すればよい。ここでは英語が苦手な方のために、公式ページと同じ内容を説明する。最新の情報は公式ページを参照されたい。
https://gyazo.com/ccebd3851e6da54e62d3a4bcfe7cfb54
google-home-notifierパッケージをインストールする。(数分ほどかかるので、のんびり待つ)
(もし、まだNode.jsをインストールしていないなら、こちら → node.jsの導入)
code:sh
$ cd ~/homebot
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - # ラズパイZeroでは不要?
$ sudo apt install git-core libnss-mdns libavahi-compat-libdnssd-dev
$ npm install google-home-notifier --save
ラズパイZeroでも動作報告を頂いています → Part2 960氏、 Part3 583氏
修正を加える
ファイル node_modules/mdns/lib/browser.js を以下のように修正する。
119行目(ファイルの一番下のあたり)
修正前:getaddrinfo()
修正後:getaddrinfo({families:[4]})
(ファイルの編集には、nano というエディタを使う。nanoの使い方はこちら → nano)
code:sh
$ nano node_modules/mdns/lib/browser.js
修正後は以下のようになる。
code:js
Browser.defaultResolverSequence = [
rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo({families:4})
, rst.makeAddressesUnique()
];
後は、Google Homeの喋らせ方 の「テキストをGoogle Homeに喋らせるUNIXコマンドを作る」以降と同じ作業をすればよい。
ただし、Raspberry Pi で google-home-notifier を実行する際には、残念ながら、以下のような警告が出る。
このAvahi云々という警告は無視して構わない。(Homebridgeの公式ページで「can be safely ignored」と明言されている。)
code:sh
- https://github.com/nfarina/homebridge/blob/master/README.md#errors-on-startup
- https://github.com/thkl/homebridge-homematic/issues/41
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointerde/avahi-compat?s=libdns_sd&e=nodejs
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointerde/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister
2018/1/19
Copyright (C) 2017-2018 Tak Jaga